@extends('backend::layout')
@section('title',$page_title)
@section('content')
        {{$search_tpl->render()}}
        @component('backend::component.table.table-content')
            @slot('page_title')配置管理@endslot
            @slot('tools_btn')
                @component('backend::component.form.button')
                    @slot('elem') a @endslot
                    @slot('title')添加配置@endslot
                    @slot('icon') hcl-add @endslot
                    @slot('size') sm @endslot
                    @slot('href') {{route('b_Config_showAddForm')}} @endslot
                @endcomponent
                @component('backend::component.form.button')
                    @slot('title')批量删除@endslot
                    @slot('color') danger @endslot
                    @slot('icon') hcl-remove @endslot
                    @slot('size') sm @endslot
                    @slot('class') btn-ajax @endslot
                    @slot('params') {"url":"{{route('b_Config_batchDelete')}}","title":"删除配置","targetData":".id","confirm":"true"} @endslot
                @endcomponent
            @endslot
            @slot('body_content')
                @if($list->isNotEmpty())
                    <table class="table table-striped table-bordered">
                        <thead><tr>
                            <th>
                                @component('backend::component.checkbox')
                                    @slot('name') ids-all @endslot
                                @endcomponent
                            </th>
                            <th>标识</th><th>配置标题</th><th>分组</th><th>类型</th><th>状态</th><th>操作</th>
                            </tr>
                        </thead>
                         <tbody>
                            @foreach($list as $value)
                                <tr>
                                    <td>
                                            @component('backend::component.checkbox')
                                                @slot('name') id[] @endslot
                                                @slot('class') id @endslot
                                                @slot('value') {{$value->id}} @endslot
                                            @endcomponent
                                    </td>
                                    <td>{{$value->name}}</td>
                                    <td>{{$value->title}}</td>
                                    <td>{{$config_group[$value->group]}}</td>
                                    <td>{{$config_type[$value->type]}}</td>
                                    <td>
                                        @component("backend::component.switch")
                                            @slot('params'){"url":"{{route('b_Config_switchConfig',['name'=>$value->name])}}"} @endslot
                                            @slot('checked') @if($value->status == 1) checked @endif @endslot
                                        @endcomponent
                                    </td>
                                    <td>
                                        @component('backend::component.form.button')
                                            @slot('elem') a @endslot
                                            @slot('icon') hcl-edit1 @endslot
                                            @slot('size') sm @endslot
                                            @slot('color') info @endslot
                                            @slot('href') {{route('b_Config_showEditForm',['name'=>$value->name])}} @endslot
                                        @endcomponent

                                        @component('backend::component.form.button')
                                            @slot('color') danger @endslot
                                            @slot('icon') hcl-remove @endslot
                                            @slot('size') sm @endslot
                                            @slot('class') btn-ajax @endslot
                                            @slot('params') {"url":"{{route('b_Config_delete',['name'=>$value->name])}}","title":"删除配置","confirm":"true"} @endslot
                                        @endcomponent
                                    </td>
                                </tr>
                            @endforeach
                         </tbody>
                    </table>
                    @if($list->total()>$list->perPage())
                        @slot('list_page')
                            {{$list->appends($search->getSearchData)->links('backend::public.pagination')}}
                        @endslot
                    @endif
                @else
                    @component('backend::public.empty_page')
                        @slot('info') 暂未配置信息 @endslot
                    @endcomponent
                @endif
            @endslot
        @endcomponent
@endsection